package mytaxy.tpagp;

import mytaxy.tpagp.Drivers.DriversActivity;
import mytaxy.tpagp.Map.MapsActivity;
import mytaxy.tpagp.Reminder.Reminder;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;

public class MenuActivity extends ListActivity { //http://developer.android.com/resources/tutorials/views/hello-listview.html
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        String[] datosmenu = getResources().getStringArray(R.array.menucontent);
        setListAdapter(new ArrayAdapter<String>(this, R.layout.list, datosmenu));

        final ListView lv = getListView();
        lv.setTextFilterEnabled(true);

        lv.setOnItemClickListener(new OnItemClickListener() {
          public void onItemClick(AdapterView<?> parent, View view,
              int position, long id) {
              //long[] a = lv.getCheckedItemIds();
              
              String z = (String) getListAdapter().getItem(position);
              System.out.println(z);
              if (z.equals("Where Am I?")) startActivity(new Intent(MenuActivity.this,MapsActivity.class));
              if (z.equals("Favourite Drivers")) startActivity(new Intent(MenuActivity.this,DriversActivity.class));
              if (z.equals("Reminder")) startActivity(new Intent(MenuActivity.this,Reminder.class));
          }
        });
    }
}